package com.yang.controller.wx;

import com.yang.bean.MarketUser;
import com.yang.bean.common.BaseRespVo;
import com.yang.bean.zdd.bo.SubmitBo;
import com.yang.service.wx.WXFeedbackService;
import com.yang.utils.UserUtil;
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @ClassName WXFeedbackController
 * @Description TODO
 * @Author zhangdongdong
 * @Date 2022/9/12 14:43
 * @Version 1.0
 */
@RestController
@RequestMapping("wx/feedback")
public class WXFeedbackController {
    @Autowired
    WXFeedbackService wxFeedbackService;
    @Autowired
    DefaultWebSessionManager defaultWebSessionManager;

    @RequestMapping("submit")
    public BaseRespVo submit(@RequestBody SubmitBo submitBo, HttpServletRequest request) {
        MarketUser user = UserUtil.getUserMsg(request, defaultWebSessionManager);
        wxFeedbackService.submit(submitBo, user);
        return BaseRespVo.ok();
    }
}
